import math
import turtle
i=0
turtle.speed(0)
turtle.delay(0)
#turtle.tracer(False)
while(i<=2*3.1415926):
    p=80*(1-math.cos(i))
    x=p* math.cos(i)
    y=p* math.sin(i)
    turtle.penup()
    turtle.goto(x,y)
    turtle.pendown()
    turtle.dot(4,"green")
    i=i+0.01
turtle.seth(-180)
turtle.fd(200)
turtle.penup()
turtle.goto(-205,0)
turtle.write("ρ",True,"center")
turtle.goto(-50,-150)
turtle.write("心形线：ρ=80(1-cos(θ))",True,"center")
turtle.goto(80,180)
turtle.write('''import math''',True,"center",font=("Arial", 14))
turtle.goto(80,165)
turtle.write('''import turtle''',True,"center",font=("Arial", 14))
turtle.goto(80,145)
turtle.write('''i=0              ''',True,"center",font=("Arial", 14))
turtle.goto(80,125)
turtle.write('''import turtle''',True,"center",font=("Arial", 14))
turtle.goto(80,110)
turtle.write('''                  while(i<=2*3.1415926):''',True,"center",font=("Arial", 14))
turtle.goto(80,95)
turtle.write('''                           p=80*(1-math.cos(i))''',True,"center",font=("Arial", 14))
turtle.goto(80,80)
turtle.write('''                    x=p* math.cos(i)''',True,"center",font=("Arial", 14))
turtle.goto(80,65)
turtle.write('''                   y=p* math.sin(i)''',True,"center",font=("Arial", 14))
turtle.goto(80,50)
turtle.write('''               turtle.penup()''',True,"center",font=("Arial", 14))
turtle.goto(80,35)
turtle.write('''                 turtle.goto(x,y)''',True,"center",font=("Arial", 14))
turtle.goto(80,20)
turtle.write('''                    turtle.pendown()''',True,"center",font=("Arial", 14))
turtle.goto(80,5)
turtle.write('''                         turtle.dot(2,"green")''',True,"center",font=("Arial", 14))
turtle.goto(80,-10)
turtle.write('''       i=i+0.01''',True,"center",font=("Arial", 14))
turtle.goto(80,-25)
turtle.write('''       turtle.seth(-180)''',True,"center",font=("Arial", 14))
turtle.goto(80,-40)
turtle.write('''  turtle.fd(200)''',True,"center",font=("Arial", 14))
turtle.goto(80,-55)
turtle.write('''   turtle.penup()''',True,"center",font=("Arial", 14))
turtle.goto(80,-75)
turtle.write('''          turtle.goto(-205,0)''',True,"center",font=("Arial", 14))
turtle.goto(80,-90)
turtle.write('''                           turtle.write("ρ",True,"center")''',True,"center",font=("Arial", 14))
turtle.goto(80,-105)
turtle.write('''              turtle.goto(-50,-150)''',True,"center",font=("Arial", 14))
turtle.goto(80,-125)
turtle.write('''                                                                turtle.write("心形线：ρ=80(1-cos(θ))",True,"center")''',True,"center",font=("Arial", 14))
turtle.goto(80,-150)
turtle.write('''          代码开源！！！''',True,"center",font=("Arial", 16))
turtle.goto(80,-300)